import request from '@/api/request'

// 获取微信支付url,不传为产业链商品，1为购买模块订单
export const getWxPayUrl = (data, type = null) => {
  let url
  switch (type) {
    case 1:
      url = '/wxpay/crowdfunding/nativePay'
      break
    default:
      url = '/pay/wxpay/goods/h5Pay'
      break
  }
  return request({
    url,
    method: 'GET',
    params: data,
  })
}

// 余额购买,不传为产业链商品，1为购买模块订单
export const balancePay = (data, type = null) => {
  let url
  switch (type) {
    case 1:
      url = `/order/order/balance/${data.orderId}/${data.payAmount}`
      break
    default:
      url = `/order/module/order/balance/${data.orderId}`
      break
  }
  return request({
    url,
    method: 'POST',
  })
}
